/*用户管理文件接口 */
import request from '@/utils/request.js'
import { RecordRoleData, ReqUserListResponseData } from './type.js'
import { ReqNullResponseData } from '@/API/product/spu/type.js'

enum API {
  GetRoleList_URL = '/admin/acl/role/',
  DelRoleList_URL = '/admin/acl/role/remove/',
  AddRoleName_URL = '/admin/acl/role/save',
  UpdataRoleName_URL = '/admin/acl/role/update'
}

export const reqHasRoleList = (page: number, limit: number, roleName?: string) =>
  request.get<any, ReqUserListResponseData>(
    API.GetRoleList_URL + `${page}/${limit}?roleName=${roleName}`
  )
export const reqDelRoleList = (id: number) =>
  request.delete<any, ReqNullResponseData>(API.DelRoleList_URL + `${id}`)
export const reqAddRoleName = (RoleNameData: RecordRoleData) =>
  request.post<any, ReqNullResponseData>(API.AddRoleName_URL, RoleNameData)
export const reqUpdataRoleName = (RoleNameData: RecordRoleData) =>
  request.put<any, ReqNullResponseData>(API.UpdataRoleName_URL, RoleNameData)
